<!--  -->
<template>
  <div>
      <span class="demonstration">完整功能</span>
       <el-pagination
       background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="page_sizes"
      :page-size="page_sizes[0]"
      :layout="layout"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  props:{
    total:{
      type:Number,
      default:100
    },
    page_sizes:{
      type:Array,
      default:()=>{ return [10, 20, 30, 40] }
    },//可支持翻页选项
    layout:{
      type:String,
      default:"total, sizes, prev, pager, next, jumper"
    },
  },
  data () {
    return {
        currentPage:1,//当前页
        page:{
          pageSize:10,
          pageNumber:1,
        }
    };
  },

  components: {},

  computed: {},

  mounted(){},

  methods: {
       handleSizeChange(val) {
         this.page.pageSize = val;
         this.$emit('pagechange',this.page)//返回对象包含页数，条数
      },
      handleCurrentChange(val) {
        this.page.pageNumber = val;
        this.$emit('pagechange',this.page)//返回对象包含页数，条数
      }
  }
}

</script>
<style lang='scss' scoped>
</style>